﻿@model QuickReview.Mvc.Models.MainViewModel
@using System.Collections
@using QuickReview.Mvc.Models
@{    
    ViewBag.Message = "Choose the shelveset you want to review.";
    ViewBag.Title = "QuickReview Home";
}

<hgroup class="title">
    <h2>@ViewBag.Message</h2>
</hgroup>
<br/>
@using (Html.BeginForm(null, null, FormMethod.Post, new { @id = "myForm" }))
{
    <div id="select-style">
        <label>User:</label>
        @Html.DropDownListFor(x => x.SelectedUser, Model.UsersChoice, new { onchange = "this.form.submit()", @class = "dropdown-style" })
        <p>@Model.Shelvesets.Count() shelvesets</p>
    </div>
  
    if (Model.Shelvesets != null && this.Model.Shelvesets.Any())
    {    
        <table id="table-style">
            <thead>
                <tr>
                    <th>Name</th>
                    <th>Date</th>
                    <th></th>
                </tr>
            </thead>            
            @for (int i = 0; i < Model.Shelvesets.Count(); i++)
            {
                var shelveset = Model.Shelvesets.ToList()[i];
                <tbody>
                <tr class="shelvesets-row">
                    <td>@Html.Encode(shelveset.Name)
                        <div id="facebookG_@i">
                            <div id="blockG_1" class="facebook_blockG"></div>
                            <div id="blockG_2" class="facebook_blockG"></div>
                            <div id="blockG_3" class="facebook_blockG"></div>
                        </div>
                    </td>
                    <td>@Html.Encode(String.Format("{0:g}", shelveset.DateCreated))</td>
                    <td>
                        <div id="d_clip_container_@i" style="position:relative" onmouseover="toClipboard(@i, $(this))">
                    	    <div id="d_clip_button_@i" class="copyButton">Copy to clipboard</div>
                	   </div>
                    </td>
                </tr>   
                <tr class="reportRow">                                        
                    <td colspan="3">
                        <div class="reportDiv">
                            @Html.ActionLink("Generating report...", "PartialShelvesetReportView", shelveset, new { @class = "hidden-report-link" })
                        </div>
                    </td>
                </tr>                        
                </tbody> 
                }          
        </table>
    }    
}